#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	string s;
	cin >> s;

	s += "-";

	int len = s.size();
	vector<int> a;
	int l = 0, r = 1;
	while (r < len) {
		if (s[r] != s[l]) {
			a.push_back(r - l);
			l = r;
		}
		r++;
	}
//	if (s[r - 1] == s[l]) {
//		a.push_back(r - l);
//	}


	int ans = 0, sum = 0;
	for (int i = 0; i < a.size(); i++) {
		if (a[i] % 2) {
			ans = max(ans, sum);
			sum = 0;
		} else
			sum += a[i];
	}
	if (a.end()[-1] % 2 == 0)
		ans = max(ans, sum);
	cout << ans;
	return 0;
}
